Prior to the battle, the Ottoman and Habsburg empires had fought for about 1½ century.
In the second half of the 17th century CE increased aggressiveness of the Habsburg forces prompted new attacks from the Turks.
They were repulsed at the Battle of Saint Gotthard in 1664 CE, yet the situation remained tense.
When the Treaty of Vasvar expired in 1682 CE, the Habsburgs again started to probe the Ottoman defenses.
The grand vizier Kara Mustafa Pasha reacted with vigor and made the Austrian capital Vienna his target.
The Turks had tried to take Vienna several times before, but failed each time.
They mobilized in January 1682 CE and declared war in August, though this left them too little time to reach Vienna before the winter, so they arrived a year later.
The delay gave the Habsburgs, who had not expected such a large attack, time to prepare.
They strengthened their fortifications, cleared the area in front of the city walls and made an alliance with Poland.
The Ottoman forces, perhaps 100,000 - 150,000 strong, reached the city in July 1583 CE.
Only about 1/3 of the army took part in the siege; the rest acted as support troops.
The garrison was only 15,000 strong, partly professional and partly militia.
Reserves hovered in the area, unsure if any reinforcements would come.
They did.
The king of Poland, John III Sobieski, honored his agreement and raised a relief army of 27,000 men, though there was disagreement over who should pay for them.
Meanwhile the Turks started to dig trenches to bring their artillery in range, but they had only 150 light cannons.
These were unable to take down the city walls, so the Ottomans were forced to try mining.
The defenders rammed tree-trunks into the ground to hinder that.
The siege lasted two months, at the end of which the Austrians were starving and both sides were suffering from disease,
however the attackers were starting to break through at the Burg bastion.
By that time Sobieski had been reinforced by extra relief troops from the Holy Roman Empire, boosting his strength to 70,000 - 80,000.
Issues about payment were settled and a unified command structure was established with Sobieski at the head.
The christian army crossed the Danube unopposed and engaged the Turks in battle.
The Germans struck first, inflicting heavy losses, but were unable to break the Ottoman lines.
The Turks in turn tried to combine the field battle with a final assault on Vienna's walls.
This did not materialize as the defenders managed to defuse the Ottoman bombs.
In the meanwhile the Polish started to advance on the left flank of the Christian army.
With their attention divided between the battles, the Turks were soon surrounded.
Close to the evening the allies had finally progressed far enough to reach flat ground.
Sobieski ordered an attack of his 18,000 cavalry, one of the largest cavalry charges in history.
It included his heavy winged hussars, the Austrian cavalry and the Germans.
The attack obliterated Ottoman resistance, which was already crumbling by that time.
The Ottomans lost 20,000 men during the siege and 15,000 - 20,000 in the battle.
The allied losses were much lighter, estimated 3,500 - 4,500.
Ottoman power was not yet broken, but the initiative had shifted to the christians.
During the next 16 years they gradually pushed the Turks back and in 1699 CE gained a lot of Hungarian territory with the Treaty of Karlowitz.
War Matrix - Battle of Vienna
Age of Reason 1620 CE - 1750 CE, Battles and sieges